home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / packages / tex-latin1.el.z / tex-latin1.el
Encoding:
Text File  |  1998-05-21  |  13.8 KB  |  531 lines

  1. ;; gm-lingo.el 
  2. ;; Translate to ISO from/to net/TeX conventions  ...
  3. ;; Copyright 1993 Michael Gschwind (mike@vlsivie.tuwien.ac.at)
  4.  
  5. ;; Keywords: tex, iso, latin, 8bit
  6.  
  7. ;;  From: mike@vlsivie.tuwien.ac.at (Michael Gschwind)
  8. ;;  Newsgroups: gnu.emacs.sources
  9. ;;  Subject: tex sequence to ISO latin conversions (and back)
  10. ;;  Date: 13 Oct 1993 12:12:35 GMT
  11. ;;  
  12. ;;  The enclosed elisp file installs hooks which automatically translate
  13. ;;  TeX sequences to ISO latin1 upon loading of a TeX file in emacs. This
  14. ;;  allows editing of TeX documents without having to type escape
  15. ;;  sequences.  Upon saving a file, ISO latin1 characters are converted
  16. ;;  back to TeX sequences. (If you have a tex style which can handle 8 bit
  17. ;;  characters, this part is not necessary, but the loading half is still
  18. ;;  neat to convert old files to 8 bit - also, 8 bit are less portable
  19. ;;  than 7...) 
  20. ;;  
  21. ;;  It also contains a function 'german which translates net conventions
  22. ;;  for typing german characters into the real thing - if you install this
  23. ;;  in news-reader/mail/whatever hooks, you'll never again be bothered
  24. ;;  with having to read characters like "s or \3 or "a etc.
  25. ;;  
  26. ;;  mike
  27. ;;  
  28.  
  29. ;; This file works with GNU Emacs19 or higher, but is not part of GNU Emacs.
  30.  
  31. ;; This program is free software; you can redistribute it and/or modify
  32. ;; it under the terms of the GNU General Public License as published by
  33. ;; the Free Software Foundation; either version 2 of the License, or
  34. ;; (at your option) any later version.
  35. ;;
  36. ;; This program is distributed in the hope that it will be useful,
  37. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  38. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  39. ;; GNU General Public License for more details.
  40. ;;
  41. ;; You should have received a copy of the GNU General Public License
  42. ;; along with this program; if not, write to the Free Software
  43. ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  44.  
  45. ; it's the author's first lisp program in a long time, so don't judge 
  46. ; him by it :( 
  47.  
  48. ; to do: translate buffer when displaying from GNUS, 
  49. ; use function 'german which does the Right Thing
  50. ; upon saving, the buffer reverts to TeX format...
  51.  
  52. ; Description:
  53. ; calling 'german will turn the net convention f. umlauts ("a etc.) 
  54. ; into ISO latin umlaute for easy reading.
  55. ; hooks change TeX files to latin1 for editing and back to TeX sequences 
  56. ; for calling TeX. An alternative is a TeX style that handles 
  57. ; 8 bit ISO files (available on ftp.vlsivie.tuwien.ac.at in /pub/8bit) 
  58. ; - but these files are difficult to transmit ... so while the net is  
  59. ; still @ 7 bit this may be useful
  60. ;
  61. ; fixed bug that causes uppercase umlauts to become lower case by 
  62. ; conversion -- msz 960429
  63.  
  64. (defvar spanish-trans-tab '(
  65.                 ("~n" "±")
  66.                 ("\([a-zA-Z]\)#" "\\1±")
  67.                 ("~N" "╤")
  68.                 ( "\\([-a-zA-Z\"`]\\)\"u" "\\1ⁿ")
  69.                 ( "\\([-a-zA-Z\"`]\\)\"U" "\\1▄")
  70.                 ( "\\([-a-zA-Z]\\)'o" "\\1≤")
  71.                 ( "\\([-a-zA-Z]\\)'O" "\\╙")
  72.                 ( "\\([-a-zA-Z]\\)'e" "\\1Θ")
  73.                 ( "\\([-a-zA-Z]\\)'E" "\\1╔")
  74.                 ( "\\([-a-zA-Z]\\)'a" "\\1ß")
  75.                 ( "\\([-a-zA-Z]\\)'A" "\\1A")
  76.                 ( "\\([-a-zA-Z]\\)'i" "\\1φ")
  77.                 ( "\\([-a-zA-Z]\\)'I" "\\1═")
  78.                )
  79.   "Spanish")
  80.  
  81. (defun translate-conventions (trans-tab)
  82.   (interactive)
  83.   (save-excursion
  84.     (widen)
  85.     (goto-char (point-min))
  86.     (setq save-case-fold-search case-fold-search) ;; msz 960429
  87.     (setq case-fold-search nil)                   ;; 
  88.     (let ((work-tab trans-tab)
  89.       (buffer-read-only nil))
  90.       (while work-tab
  91.     (save-excursion
  92.       (let ((trans-this (car work-tab)))
  93.         (while (re-search-forward (car trans-this) nil t)
  94.           (replace-match (car (cdr trans-this)) nil nil)))
  95.       (setq work-tab (cdr work-tab)))))
  96.     (setq case-fold-serch save-case-fold-search)))
  97.  
  98. (defun spanish ()
  99.   "Translate net conventions for Spanish to ISO"
  100.   (interactive)
  101.   (translate-conventions spanish-trans-tab))
  102.  
  103. (defvar aggressive-german-trans-tab '(
  104.            ( "\"a" "Σ")
  105.            ( "\"A" "─")
  106.            ( "\"o" "÷")
  107.            ( "\"O" "╓")
  108.            ( "\"u" "ⁿ")
  109.            ( "\"U" "▄")
  110.            ( "\"s" "▀")
  111.            ( "\\\\3" "▀")
  112.            )
  113.   "German - may do too much")
  114.  
  115. (defvar conservative-german-trans-tab '(
  116.            ( "\\([-a-zA-Z\"`]\\)\"a" "\\1Σ")
  117.            ( "\\([-a-zA-Z\"`]\\)\"A" "\\1─")
  118.            ( "\\([-a-zA-Z\"`]\\)\"o" "\\1÷")
  119.            ( "\\([-a-zA-Z\"`]\\)\"O" "\\1╓")
  120.            ( "\\([-a-zA-Z\"`]\\)\"u" "\\1ⁿ")
  121.            ( "\\([-a-zA-Z\"`]\\)\"U" "\\1▄")
  122.            ( "\\([-a-zA-Z\"`]\\)\"s" "\\1▀")
  123.            ( "\\([-a-zA-Z\"`]\\)\\\\3" "\\1▀")
  124.            )
  125.   "conservative German - may do too little")
  126.  
  127.  
  128. (defvar german-trans-tab aggressive-german-trans-tab "used for char translation")
  129.  
  130. (defun german ()
  131.  "Translate net conventions for German to ISO"
  132.  (interactive)
  133.  (translate-conventions german-trans-tab))
  134.  
  135. (defvar iso2tex-trans-tab '(
  136.                 ("Σ" "{\\\\\"a}")
  137.                 ("α" "{\\\\`a}")
  138.                 ("ß" "{\\\\'a}")
  139.                 ("π" "{\\\\~a}")
  140.                 ("Γ" "{\\\\^a}")
  141.                 ("δ" "{\\\\\"e}")
  142.                 ("Φ" "{\\\\`e}")
  143.                 ("Θ" "{\\\\'e}")
  144.                 ("Ω" "{\\\\^e}")
  145.                 ("∩" "{\\\\\"\\\\i}")
  146.                 ("∞" "{\\\\`\\\\i}")
  147.                 ("φ" "{\\\\'\\\\i}")
  148.                 ("ε" "{\\\\^\\\\i}")
  149.                 ("÷" "{\\\\\"o}")
  150.                 ("≥" "{\\\\`o}")
  151.                 ("≤" "{\\\\'o}")
  152.                 ("⌡" "{\\\\~o}")
  153.                 ("⌠" "{\\\\^o}")
  154.                 ("ⁿ" "{\\\\\"u}")
  155.                 ("∙" "{\\\\`u}")
  156.                 ("·" "{\\\\'u}")
  157.                 ("√" "{\\\\^u}")
  158.                 ("─" "{\\\\\"A}")
  159.                 ("└" "{\\\\`A}")
  160.                 ("┴" "{\\\\'A}")
  161.                 ("├" "{\\\\~A}")
  162.                 ("┬" "{\\\\^A}")
  163.                 ("╦" "{\\\\\"E}")
  164.                 ("╚" "{\\\\`E}")
  165.                 ("╔" "{\\\\'E}")
  166.                 ("╩" "{\\\\^E}")
  167.                 ("╧" "{\\\\\"I}")
  168.                 ("╠" "{\\\\`I}")
  169.                 ("═" "{\\\\'I}")
  170.                 ("╬" "{\\\\^I}")
  171.                 ("╓" "{\\\\\"O}")
  172.                 ("╥" "{\\\\`O}")
  173.                 ("╙" "{\\\\'O}")
  174.                 ("╒" "{\\\\~O}")
  175.                 ("╘" "{\\\\^O}")
  176.                 ("▄" "{\\\\\"U}")
  177.                 ("┘" "{\\\\`U}")
  178.                 ("┌" "{\\\\'U}")
  179.                 ("█" "{\\\\^U}")
  180.                 ("±" "{\\\\~n}")
  181.                 ("╤" "{\\\\~N}")
  182.                 ("τ" "{\\\\c c}")
  183.                 ("╟" "{\\\\c C}")
  184.                 ("▀" "{\\\\ss}")
  185.                 ("┐" "{?`}")
  186.                 ("í" "{!`}")
  187.                 )
  188.   )
  189.  
  190.  
  191.  
  192.  
  193. (defun iso2tex ()
  194.  "Translate ISO to TeX"
  195.  (interactive)
  196.  (translate-conventions iso2tex-trans-tab))
  197.  
  198.  
  199. (defvar tex2iso-trans-tab '(
  200.                 ( "{\\\\\"a}" "Σ")
  201.                 ( "{\\\\`a}" "α")
  202.                 ( "{\\\\'a}" "ß")
  203.                 ( "{\\\\~a}" "π")
  204.                 ( "{\\\\^a}" "Γ")
  205.                 ( "{\\\\\"e}" "δ")
  206.                 ( "{\\\\`e}" "Φ")
  207.                 ( "{\\\\'e}" "Θ")
  208.                 ( "{\\\\^e}" "Ω")
  209.                 ( "{\\\\\"\\\\i}" "∩")
  210.                 ( "{\\\\`\\\\i}" "∞")
  211.                 ( "{\\\\'\\\\i}" "φ")
  212.                 ( "{\\\\^\\\\i}" "ε")
  213.                 ( "{\\\\\"i}" "∩")
  214.                 ( "{\\\\`i}" "∞")
  215.                 ( "{\\\\'i}" "φ")
  216.                 ( "{\\\\^i}" "ε")
  217.                 ( "{\\\\\"o}" "÷")
  218.                 ( "{\\\\`o}" "≥")
  219.                 ( "{\\\\'o}" "≤")
  220.                 ( "{\\\\~o}" "⌡")
  221.                 ( "{\\\\^o}" "⌠")
  222.                 ( "{\\\\\"u}" "ⁿ")
  223.                 ( "{\\\\`u}" "∙")
  224.                 ( "{\\\\'u}" "·")
  225.                 ( "{\\\\^u}" "√")
  226.                 ( "{\\\\\"A}" "─")
  227.                 ( "{\\\\`A}" "└")
  228.                 ( "{\\\\'A}" "┴")
  229.                 ( "{\\\\~A}" "├")
  230.                 ( "{\\\\^A}" "┬")
  231.                 ( "{\\\\\"E}" "╦")
  232.                 ( "{\\\\`E}" "╚")
  233.                 ( "{\\\\'E}" "╔")
  234.                 ( "{\\\\^E}" "╩")
  235.                 ( "{\\\\\"I}" "╧")
  236.                 ( "{\\\\`I}" "╠")
  237.                 ( "{\\\\'I}" "═")
  238.                 ( "{\\\\^I}" "╬")
  239.                 ( "{\\\\\"O}" "╓")
  240.                 ( "{\\\\`O}" "╥")
  241.                 ( "{\\\\'O}" "╙")
  242.                 ( "{\\\\~O}" "╒")
  243.                 ( "{\\\\^O}" "╘")
  244.                 ( "{\\\\\"U}" "▄")
  245.                 ( "{\\\\`U}" "┘")
  246.                 ( "{\\\\'U}" "┌")
  247.                 ( "{\\\\^U}" "█")
  248.                 ( "{\\\\~n}" "±")
  249.                 ( "{\\\\~N}" "╤")
  250.                 ( "{\\\\c c}" "τ")
  251.                 ( "{\\\\c C}" "╟")
  252.                 ( "\\\\\"{a}" "Σ")
  253.                 ( "\\\\`{a}" "α")
  254.                 ( "\\\\'{a}" "ß")
  255.                 ( "\\\\~{a}" "π")
  256.                 ( "\\\\^{a}" "Γ")
  257.                 ( "\\\\\"{e}" "δ")
  258.                 ( "\\\\`{e}" "Φ")
  259.                 ( "\\\\'{e}" "Θ")
  260.                 ( "\\\\^{e}" "Ω")
  261.                 ( "\\\\\"{\\\\i}" "∩")
  262.                 ( "\\\\`{\\\\i}" "∞")
  263.                 ( "\\\\'{\\\\i}" "φ")
  264.                 ( "\\\\^{\\\\i}" "ε")
  265.                 ( "\\\\\"{i}" "∩")
  266.                 ( "\\\\`{i}" "∞")
  267.                 ( "\\\\'{i}" "φ")
  268.                 ( "\\\\^{i}" "ε")
  269.                 ( "\\\\\"{o}" "÷")
  270.                 ( "\\\\`{o}" "≥")
  271.                 ( "\\\\'{o}" "≤")
  272.                 ( "\\\\~{o}" "⌡")
  273.                 ( "\\\\^{o}" "⌠")
  274.                 ( "\\\\\"{u}" "ⁿ")
  275.                 ( "\\\\`{u}" "∙")
  276.                 ( "\\\\'{u}" "·")
  277.                 ( "\\\\^{u}" "√")
  278.                 ( "\\\\\"{A}" "─")
  279.                 ( "\\\\`{A}" "└")
  280.                 ( "\\\\'{A}" "┴")
  281.                 ( "\\\\~{A}" "├")
  282.                 ( "\\\\^{A}" "┬")
  283.                 ( "\\\\\"{E}" "╦")
  284.                 ( "\\\\`{E}" "╚")
  285.                 ( "\\\\'{E}" "╔")
  286.                 ( "\\\\^{E}" "╩")
  287.                 ( "\\\\\"{I}" "╧")
  288.                 ( "\\\\`{I}" "╠")
  289.                 ( "\\\\'{I}" "═")
  290.                 ( "\\\\^{I}" "╬")
  291.                 ( "\\\\\"{O}" "╓")
  292.                 ( "\\\\`{O}" "╥")
  293.                 ( "\\\\'{O}" "╙")
  294.                 ( "\\\\~{O}" "╒")
  295.                 ( "\\\\^{O}" "╘")
  296.                 ( "\\\\\"{U}" "▄")
  297.                 ( "\\\\`{U}" "┘")
  298.                 ( "\\\\'{U}" "┌")
  299.                 ( "\\\\^{U}" "█")
  300.                 ( "\\\\~{n}" "±")
  301.                 ( "\\\\~{N}" "╤")
  302.                 ( "\\\\c{c}" "τ")
  303.                 ( "\\\\c{C}" "╟")
  304.                 ( "{\\\\ss}" "▀")
  305.                 ( "{?`}" "┐")
  306.                 ( "{!`}" "í")
  307.                 )
  308.   )
  309.  
  310. (defun tex2iso ()
  311.  "Translate TeX to ISO"
  312.  (interactive)
  313.  (translate-conventions tex2iso-trans-tab))
  314.  
  315. (defvar gtex2iso-trans-tab '(
  316.                 ( "\"a" "Σ")
  317.                 ( "\"A" "─")
  318.                 ( "\"o" "÷")
  319.                 ( "\"O" "╓")
  320.                 ( "\"u" "ⁿ")
  321.                 ( "\"U" "▄")
  322.                 ( "\"s" "▀")
  323.                 ( "\\\\3" "▀")
  324.                 ( "{\\\\\"a}" "Σ")
  325.                 ( "{\\\\`a}" "α")
  326.                 ( "{\\\\'a}" "ß")
  327.                 ( "{\\\\~a}" "π")
  328.                 ( "{\\\\^a}" "Γ")
  329.                 ( "{\\\\\"e}" "δ")
  330.                 ( "{\\\\`e}" "Φ")
  331.                 ( "{\\\\'e}" "Θ")
  332.                 ( "{\\\\^e}" "Ω")
  333.                 ( "{\\\\\"\\\\i}" "∩")
  334.                 ( "{\\\\`\\\\i}" "∞")
  335.                 ( "{\\\\'\\\\i}" "φ")
  336.                 ( "{\\\\^\\\\i}" "ε")
  337.                 ( "{\\\\\"i}" "∩")
  338.                 ( "{\\\\`i}" "∞")
  339.                 ( "{\\\\'i}" "φ")
  340.                 ( "{\\\\^i}" "ε")
  341.                 ( "{\\\\\"o}" "÷")
  342.                 ( "{\\\\`o}" "≥")
  343.                 ( "{\\\\'o}" "≤")
  344.                 ( "{\\\\~o}" "⌡")
  345.                 ( "{\\\\^o}" "⌠")
  346.                 ( "{\\\\\"u}" "ⁿ")
  347.                 ( "{\\\\`u}" "∙")
  348.                 ( "{\\\\'u}" "·")
  349.                 ( "{\\\\^u}" "√")
  350.                 ( "{\\\\\"A}" "─")
  351.                 ( "{\\\\`A}" "└")
  352.                 ( "{\\\\'A}" "┴")
  353.                 ( "{\\\\~A}" "├")
  354.                 ( "{\\\\^A}" "┬")
  355.                 ( "{\\\\\"E}" "╦")
  356.                 ( "{\\\\`E}" "╚")
  357.                 ( "{\\\\'E}" "╔")
  358.                 ( "{\\\\^E}" "╩")
  359.                 ( "{\\\\\"I}" "╧")
  360.                 ( "{\\\\`I}" "╠")
  361.                 ( "{\\\\'I}" "═")
  362.                 ( "{\\\\^I}" "╬")
  363.                 ( "{\\\\\"O}" "╓")
  364.                 ( "{\\\\`O}" "╥")
  365.                 ( "{\\\\'O}" "╙")
  366.                 ( "{\\\\~O}" "╒")
  367.                 ( "{\\\\^O}" "╘")
  368.                 ( "{\\\\\"U}" "▄")
  369.                 ( "{\\\\`U}" "┘")
  370.                 ( "{\\\\'U}" "┌")
  371.                 ( "{\\\\^U}" "█")
  372.                 ( "{\\\\~n}" "±")
  373.                 ( "{\\\\~N}" "╤")
  374.                 ( "{\\\\c c}" "τ")
  375.                 ( "{\\\\c C}" "╟")
  376.                 ( "\\\\\"{a}" "Σ")
  377.                 ( "\\\\`{a}" "α")
  378.                 ( "\\\\'{a}" "ß")
  379.                 ( "\\\\~{a}" "π")
  380.                 ( "\\\\^{a}" "Γ")
  381.                 ( "\\\\\"{e}" "δ")
  382.                 ( "\\\\`{e}" "Φ")
  383.                 ( "\\\\'{e}" "Θ")
  384.                 ( "\\\\^{e}" "Ω")
  385.                 ( "\\\\\"{\\\\i}" "∩")
  386.                 ( "\\\\`{\\\\i}" "∞")
  387.                 ( "\\\\'{\\\\i}" "φ")
  388.                 ( "\\\\^{\\\\i}" "ε")
  389.                 ( "\\\\\"{i}" "∩")
  390.                 ( "\\\\`{i}" "∞")
  391.                 ( "\\\\'{i}" "φ")
  392.                 ( "\\\\^{i}" "ε")
  393.                 ( "\\\\\"{o}" "÷")
  394.                 ( "\\\\`{o}" "≥")
  395.                 ( "\\\\'{o}" "≤")
  396.                 ( "\\\\~{o}" "⌡")
  397.                 ( "\\\\^{o}" "⌠")
  398.                 ( "\\\\\"{u}" "ⁿ")
  399.                 ( "\\\\`{u}" "∙")
  400.                 ( "\\\\'{u}" "·")
  401.                 ( "\\\\^{u}" "√")
  402.                 ( "\\\\\"{A}" "─")
  403.                 ( "\\\\`{A}" "└")
  404.                 ( "\\\\'{A}" "┴")
  405.                 ( "\\\\~{A}" "├")
  406.                 ( "\\\\^{A}" "┬")
  407.                 ( "\\\\\"{E}" "╦")
  408.                 ( "\\\\`{E}" "╚")
  409.                 ( "\\\\'{E}" "╔")
  410.                 ( "\\\\^{E}" "╩")
  411.                 ( "\\\\\"{I}" "╧")
  412.                 ( "\\\\`{I}" "╠")
  413.                 ( "\\\\'{I}" "═")
  414.                 ( "\\\\^{I}" "╬")
  415.                 ( "\\\\\"{O}" "╓")
  416.                 ( "\\\\`{O}" "╥")
  417.                 ( "\\\\'{O}" "╙")
  418.                 ( "\\\\~{O}" "╒")
  419.                 ( "\\\\^{O}" "╘")
  420.                 ( "\\\\\"{U}" "▄")
  421.                 ( "\\\\`{U}" "┘")
  422.                 ( "\\\\'{U}" "┌")
  423.                 ( "\\\\^{U}" "█")
  424.                 ( "\\\\~{n}" "±")
  425.                 ( "\\\\~{N}" "╤")
  426.                 ( "\\\\c{c}" "τ")
  427.                 ( "\\\\c{C}" "╟")
  428.                 ( "{\\\\ss}" "▀")
  429.                 ( "{?`}" "┐")
  430.                 ( "{!`}" "í")
  431.                 )
  432.   )
  433.  
  434. (defvar iso2gtex-trans-tab '(
  435.                 ("Σ" "\"a")
  436.                 ("α" "{\\\\`a}")
  437.                 ("ß" "{\\\\'a}")
  438.                 ("π" "{\\\\~a}")
  439.                 ("Γ" "{\\\\^a}")
  440.                 ("δ" "{\\\\\"e}")
  441.                 ("Φ" "{\\\\`e}")
  442.                 ("Θ" "{\\\\'e}")
  443.                 ("Ω" "{\\\\^e}")
  444.                 ("∩" "{\\\\\"\\\\i}")
  445.                 ("∞" "{\\\\`\\\\i}")
  446.                 ("φ" "{\\\\'\\\\i}")
  447.                 ("ε" "{\\\\^\\\\i}")
  448.                 ("÷" "\"o")
  449.                 ("≥" "{\\\\`o}")
  450.                 ("≤" "{\\\\'o}")
  451.                 ("⌡" "{\\\\~o}")
  452.                 ("⌠" "{\\\\^o}")
  453.                 ("ⁿ" "\"u")
  454.                 ("∙" "{\\\\`u}")
  455.                 ("·" "{\\\\'u}")
  456.                 ("√" "{\\\\^u}")
  457.                 ("─" "\"A")
  458.                 ("└" "{\\\\`A}")
  459.                 ("┴" "{\\\\'A}")
  460.                 ("├" "{\\\\~A}")
  461.                 ("┬" "{\\\\^A}")
  462.                 ("╦" "{\\\\\"E}")
  463.                 ("╚" "{\\\\`E}")
  464.                 ("╔" "{\\\\'E}")
  465.                 ("╩" "{\\\\^E}")
  466.                 ("╧" "{\\\\\"I}")
  467.                 ("╠" "{\\\\`I}")
  468.                 ("═" "{\\\\'I}")
  469.                 ("╬" "{\\\\^I}")
  470.                 ("╓" "\"O")
  471.                 ("╥" "{\\\\`O}")
  472.                 ("╙" "{\\\\'O}")
  473.                 ("╒" "{\\\\~O}")
  474.                 ("╘" "{\\\\^O}")
  475.                 ("▄" "\"U")
  476.                 ("┘" "{\\\\`U}")
  477.                 ("┌" "{\\\\'U}")
  478.                 ("█" "{\\\\^U}")
  479.                 ("±" "{\\\\~n}")
  480.                 ("╤" "{\\\\~N}")
  481.                 ("τ" "{\\\\c c}")
  482.                 ("╟" "{\\\\c C}")
  483.                 ("▀" "\\\\3")
  484.                 ("┐" "{?`}")
  485.                 ("í" "{!`}")
  486.                 )
  487.   )
  488.  
  489.  
  490.  
  491. (defun gtex2iso ()
  492.  "Translate german TeX to ISO"
  493.  (interactive)
  494.  (translate-conventions gtex2iso-trans-tab))
  495.  
  496.  
  497. (defun iso2gtex ()
  498.  "Translate ISO to german TeX"
  499.  (interactive)
  500.  (translate-conventions iso2gtex-trans-tab))
  501.  
  502.  
  503. (defun german-texP ()
  504.  "Check if tex buffer is german LaTeX"
  505.  (save-excursion
  506.    (widen)
  507.    (goto-char (point-min))
  508.    (re-search-forward "\\\\documentstyle\\[.*german.*\\]" nil t)))
  509.  
  510.  
  511. (defun fix-iso2tex ()
  512.   "Turn ISO latin1 into TeX sequences"
  513.   (if (equal major-mode 'latex-mode)
  514.       (if (german-texP)
  515.       (iso2gtex)
  516.     (iso2tex)))
  517.   (if (equal major-mode 'tex-mode)
  518.       (iso2tex)))
  519.  
  520. (defun fix-tex2iso ()
  521.   "Turn TeX sequences into ISO latin1"
  522.   (if (equal major-mode 'latex-mode)
  523.       (if (german-texP)
  524.       (gtex2iso)
  525.     (tex2iso)))
  526.   (if (equal major-mode 'tex-mode)
  527.       (tex2iso)))
  528.  
  529. (add-hook 'find-file-hooks 'fix-tex2iso)
  530. (add-hook 'write-file-hooks 'fix-iso2tex)
  531.